package com.zjcloud.jwgl.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zjcloud.jwgl.mapper.AcConstraintTypeMapper;
import com.zjcloud.jwgl.domain.AcConstraintType;
import com.zjcloud.jwgl.service.IAcConstraintTypeService;

/**
 * 约束类型Service业务层处理
 * 
 * @author zjcloud
 * @date 2024-01-01
 */
@Service
public class AcConstraintTypeServiceImpl implements IAcConstraintTypeService 
{
    @Autowired
    private AcConstraintTypeMapper acConstraintTypeMapper;

    /**
     * 查询约束类型
     * 
     * @param id 约束类型主键
     * @return 约束类型
     */
    @Override
    public AcConstraintType selectAcConstraintTypeById(Long id)
    {
        return acConstraintTypeMapper.selectAcConstraintTypeById(id);
    }

    /**
     * 根据类型编码查询约束类型
     * 
     * @param typeCode 类型编码
     * @return 约束类型
     */
    @Override
    public AcConstraintType selectAcConstraintTypeByCode(String typeCode)
    {
        return acConstraintTypeMapper.selectAcConstraintTypeByCode(typeCode);
    }

    /**
     * 查询约束类型列表
     * 
     * @param acConstraintType 约束类型
     * @return 约束类型
     */
    @Override
    public List<AcConstraintType> selectAcConstraintTypeList(AcConstraintType acConstraintType)
    {
        return acConstraintTypeMapper.selectAcConstraintTypeList(acConstraintType);
    }

    /**
     * 查询启用的约束类型列表
     * 
     * @return 约束类型集合
     */
    @Override
    public List<AcConstraintType> selectEnabledConstraintTypes()
    {
        return acConstraintTypeMapper.selectEnabledConstraintTypes();
    }

    /**
     * 根据分类查询约束类型列表
     * 
     * @param category 分类(HARD-硬约束 SOFT-软约束)
     * @return 约束类型集合
     */
    @Override
    public List<AcConstraintType> selectConstraintTypesByCategory(String category)
    {
        return acConstraintTypeMapper.selectConstraintTypesByCategory(category);
    }

    /**
     * 查询系统内置约束类型列表
     * 
     * @return 约束类型集合
     */
    @Override
    public List<AcConstraintType> selectSystemConstraintTypes()
    {
        return acConstraintTypeMapper.selectSystemConstraintTypes();
    }

    /**
     * 新增约束类型
     * 
     * @param acConstraintType 约束类型
     * @return 结果
     */
    @Override
    public int insertAcConstraintType(AcConstraintType acConstraintType)
    {
        return acConstraintTypeMapper.insertAcConstraintType(acConstraintType);
    }

    /**
     * 修改约束类型
     * 
     * @param acConstraintType 约束类型
     * @return 结果
     */
    @Override
    public int updateAcConstraintType(AcConstraintType acConstraintType)
    {
        return acConstraintTypeMapper.updateAcConstraintType(acConstraintType);
    }

    /**
     * 批量删除约束类型
     * 
     * @param ids 需要删除的约束类型主键
     * @return 结果
     */
    @Override
    public int deleteAcConstraintTypeByIds(Long[] ids)
    {
        return acConstraintTypeMapper.deleteAcConstraintTypeByIds(ids);
    }

    /**
     * 删除约束类型信息
     * 
     * @param id 约束类型主键
     * @return 结果
     */
    @Override
    public int deleteAcConstraintTypeById(Long id)
    {
        return acConstraintTypeMapper.deleteAcConstraintTypeById(id);
    }

    /**
     * 检查类型编码是否存在
     * 
     * @param typeCode 类型编码
     * @return 结果
     */
    @Override
    public int checkTypeCodeUnique(String typeCode)
    {
        return acConstraintTypeMapper.checkTypeCodeUnique(typeCode);
    }

    /**
     * 检查类型编码是否存在(排除指定ID)
     * 
     * @param typeCode 类型编码
     * @param id 排除的ID
     * @return 结果
     */
    @Override
    public int checkTypeCodeUniqueExcludeId(String typeCode, Long id)
    {
        return acConstraintTypeMapper.checkTypeCodeUniqueExcludeId(typeCode, id);
    }

    /**
     * 更新约束类型状态
     * 
     * @param id 约束类型ID
     * @param enabled 启用状态
     * @return 结果
     */
    @Override
    public int updateConstraintTypeStatus(Long id, String enabled)
    {
        return acConstraintTypeMapper.updateConstraintTypeStatus(id, enabled);
    }

    /**
     * 批量更新约束类型状态
     * 
     * @param ids 约束类型ID数组
     * @param enabled 启用状态
     * @return 结果
     */
    @Override
    public int batchUpdateConstraintTypeStatus(Long[] ids, String enabled)
    {
        return acConstraintTypeMapper.batchUpdateConstraintTypeStatus(ids, enabled);
    }
}